import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location){
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  routes: [
    {
      path: '/',
      component: resolve =>
      require(["@/components/login/Login.vue"], resolve)
    },
    {
      path: "/login",
      component: resolve =>
        require(["@/components/login/Login.vue"], resolve)
    },

    {
      path: "/main",
      component: resolve =>
        require(["@/components/common/Main.vue"], resolve),
      children: [
        {
          path: "/",
          component: resolve =>
          require(["@/components/common/Base.vue"], resolve)
        },
        {
          path: 'navigation',
          component: resolve =>
          require(["@/components/nav/Navigation.vue"], resolve)
        },
        {
          path: 'carousel',
          component: resolve =>
          require(["@/components/carousel/Carousel.vue"], resolve)
        },
        {
          path: "news",
          component: resolve =>
          require(["@/components/news/News.vue"], resolve)
        },
        {
          path: "consultation",
          component: resolve =>
          require(["@/components/consultation/Consultation.vue"], resolve)
        },
        {
          path: "shoolItem",
          component: resolve =>
          require(["@/components/shoolItem/ShoolItem.vue"], resolve)
        },
        {
          path: "friendLink",
          component: resolve =>
          require(["@/components/friendLink/FriendLink.vue"], resolve)
        },
        {
          path: "otherNews",
          component: resolve =>
          require(["@/components/news/OtherNews.vue"], resolve)
        },
  
        {
          path: "user",
          component: resolve =>
          require(["@/components/user/User.vue"], resolve)
        },
        {
          path: "configItem",
          component: resolve =>
          require(["@/components/configItem/configItem.vue"], resolve)
        },

        {
          path: "demo",
          component: resolve =>
          require(["@/components/demo/Demo.vue"], resolve)
        },

      ],
    },

  ]
})
